<?php

namespace App\Http\Controllers\Admin;

use App\models\Order;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class OrderController extends Controller
{
    public function index()
    {
        $orders = Order::paginate(6);
        return view('admin.order_index',compact('orders'));
    }
    public function changeStatus(Order $order)
    {
        return view('admin.order_changeStatus',compact('order'));
    }
    public function updateStatus(Order $order,Request $request)
    {
//        dd($request->all());
//        $order->update($request->all());
        $data = $request->all();
        $order['status'] = $data['status'];
        $order->update();
        return redirect(route('admin.order.index'))->with('success','订单状态修改成功');
    }
}
